
#include "../include/Socket.h"
#include "../include/my_header.h"
#include <sys/socket.h>

namespace wd
{

Socket::Socket()
{
    _fd = socket(AF_INET, SOCK_STREAM, 0);
    if(_fd < 0)
        perror("socket");
}


Socket::~Socket()
{
    //_fd有效时，需要关闭
    if(_fd > 0) {
        close(_fd);
    }
}

void Socket::shutdownWrite()
{
    if(_fd > 0) {
        shutdown(_fd, SHUT_WR);
    }
}

}//end of namespace wd
